package com.twu.biblioteca;

public class Movies {
    private int id;
    private String name;
    private int year;
    private String director;
    private int rating;
    private boolean isAvailable = true;

    public Movies(int movieId, String movieName, int movieYear, String movieDirector) {
        this(movieId, movieName, movieYear, movieDirector, -1);
    }

    public Movies(int movieId, String movieName, int movieYear, String movieDirector, int movieRating ) {
        id = movieId;
        name = movieName;
        year = movieYear;
        director = movieDirector;
        if ((movieRating >= -1 && movieRating <= 10))
            rating = movieRating;
    }



    public void display() {
        System.out.print(name + "\t\t" + year + "\t" + director + "\t\t" );
        if (rating != -1) {
            System.out.print( rating);
        }
        else {
            System.out.print("N/A");
        }
        System.out.println();
    }

    public boolean setAvailabilityForBorrow () {
        if(isAvailable == true ) {
            isAvailable = false;
            System.out.println("Thank you! Enjoy the book.");
            return true;
        }
        System.out.println("Sorry we don't have that book yet");
        return false;
    }

    public boolean setAvailabilityForReturn () {
        if(isAvailable == false) {
            isAvailable = true;
            System.out.println("Thank you!");
            return true;
        }
        return false;
    }


}
